import { getTwoService } from '@/api/category.js'
import { useRoute } from 'vue-router'
import { ref,onMounted } from 'vue'

export const useCategory = () => {
    const route = useRoute()
    const getTwoObj = ref({})
    const allList = ref([])
    const getTwo = async() => {
    const res = await getTwoService(route.params.id)
    allList.value = res.data.result.children
    getTwoObj.value = res.data.result
} 
    onMounted(()=>{ getTwo() })
    return {
        allList,getTwoObj
    }
}